import Vue from "vue";
import Router from "vue-router"

// 安装插件
Vue.use(Router);

// 创建vue-router对象

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/Home" //重定向
    },
    {
      name: "Home",
      path: "/Home",
      component: resolve => require(['@/vive/Home'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "My",
      path: "/My",
      component: resolve => require(['@/vive/My'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Venmous",
      path: "/Venmous",
      component: resolve => require(['@/vive/Venmous'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Service",
      path: "/Service",
      component: resolve => require(['@/vive/Service'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "DetailAll",
      path: "/DetailAll",
      component: resolve => require(['@/vive/view-cao/vivw-v/DetailAll'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "ChuanDa",
      path: "/ChuanDa",
      component: resolve => require(['@/vive/view-cao/vivw-v/ChuanDa'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "PingJia",
      path: "/PingJia",
      component: resolve => require(['@/vive/view-cao/vivw-v/PingJia'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "deWuTwo",
      path: "/deWuTwo",
      component: resolve => require(['@/vive/view-jin/vivw-v/deWuTwo'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "SerTwo",
      path: "/SerTwo",
      component: resolve => require(['@/vive/view-jin/vivw-v/SerTwo'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Active",
      path: "/Active",
      component: resolve => require(['@/vive/view-wang/view-v/Active'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Glist",
      path: "/Glist",
      component: resolve => require(['@/vive/view-wang/view-v/Goodslist'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Menu",
      path: "/Menu",
      component: resolve => require(['@/vive/view-wang/view-v/Menulist'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Login",
      path: "/Login",
      component: resolve => require(['@/vive/Login'], resolve),
       // beforeEnter: (to, from, next) => {
      //   if (localStorage.getItem("username")) {
      //     next("Personal");
      //   } else {
      //     next(true)
      //   }
      // }
    },
    {
      name: "Personal",
      path: "/Personal",
      component: resolve => require(['@/vive/view-an/view-v/Personal'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Reg",
      path: "/Reg",
      component: resolve => require(['@/vive/Reg'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "serviceC",
      path: "/serviceC",
      component: resolve => require(['@/vive/view-jin/vivw-v/severConsult'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Collection",
      path: "/Collection",
      component: resolve => require(['@/vive/view-an/view-v/Collection'], resolve),
      // beforeEnter: (to, from, next) => {
      //   if (localStorage.getItem("username")) {
      //     next(true);
      //   } else {
      //     next("/Login")
      //   }
      // }
    },
    {
      name: "Personal",
      path: "/Personal",
      component: resolve => require(['@/vive/view-an/view-v/Personal'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Shoppingcart",
      path: "/Shoppingcart",
      component: resolve => require(['@/vive/view-an/view-v/Shoppingcart'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "ZhuanQu",
      path: "/ZhuanQu",
      component: resolve => require(['@/vive/view-cao/vivw-v/ZhuanQu'], resolve),
      meta:{
        requireAuth:true
      }
    },
    {
      name: "Something",
      path: "/Something",
      component: resolve => require(['@/vive/view-wang/view-v/Something'], resolve),
      meta:{
        requireAuth: true
        // name: "DetailAll",
        // path: "/DetailAll",
        // component: resolve => require(['@/vive/view-cao/vivw-v/DetailAll'], resolve),
  
      }
    },
  ]
});